# # -*- coding: utf-8 -*-
#
# import logging
# import logging.config
# import os
#
# from flask import Flask
# from flask_cors import CORS
#
# from vsogame.contril import api
# from .config import config
# from .database import database, db
# from .extensions import marshmallow
#
# config_name = os.getenv('ENV') or 'default'
#
#
# def configure_app(app):
#     app.config.from_object(config[config_name])
#     CORS(app)
#
#
# def register_extensions(app):
#     database.init_app(app)
#     marshmallow.init_app(app)
#     db.init_app(app)
#     logging.config.fileConfig(os.getcwd() + '/logging.conf')
#
#
#     from  .extensions import redis_store
#     api.configure(
#         client_id=app.config.get('PAYMENT_CLIENT_ID'),
#         client_secret=app.config.get('PAYMENT_CLIENT_SECRET'),
#         endpoint=app.config.get('PAYMENT_ENDPOINT')
#
#     )
#     redis_store.init_app(app)
#     # sms_provider.init_app(app)
#     # gps_provider.init_app(app)
#     # if config_name == 'default':
#     #     redis_store.init_app(app)
#     # db.init_app(app)
#     # migrate.init_app(app, db)
#     # oauth.init_app(app)
#     # sentry.init_app(app)
#     # qiniu.init_app(app)
#     # fixme oss path 暂时为字符串,后期需要用 aliyun oss 生成
#     oss = app.config.get('OSS_PATH', '1')
#     # from .models.T import T
#     # database.connect()
#     # database.database.create_table(T,safe=True)
#     # print(T.get())
#
#
# def register_blueprints(app):
#     from .open_api.ProductsView import ProductsView
#     from .open_api.stock import StocksView
#     from .open_api.service import ServicesView
#     from .open_api.auth import AuthsView
#     from .open_api.shop_cart import ShopCartsView
#     from .open_api.member import MembersView
#     from .open_api.shop_cart_item import ShopCartItemsView
#     from .open_api.fund_channel import FundChannelsView
#     from .open_api.order import OrderResultView ,OrdersView
#     from .open_api.offer import OffersView
#     from .open_api.account_history import AccountHistoriesView
#
#     from auth.api.auth import AuthsView as  avview
#
#
#     AccountHistoriesView.register(app)
#     OffersView.register(app)
#     ShopCartsView.register(app)
#     ShopCartItemsView.register(app)
#     MembersView.register(app)
#     OrdersView.register(app)
#     AuthsView.register(app)
#     ServicesView.register(app)
#     ProductsView.register(app)
#     FundChannelsView.register(app)
#     StocksView.register(app)
#     OrderResultView.register(app)
#     avview.register(app, route_prefix='v2')
#
#     print(app.url_map)
#
#
# def create_app():
#     app = Flask(__name__)
#     configure_app(app)
#     register_extensions(app)
#     register_blueprints(app)
#
#     return app
